// thermistor-1.ino Simple test program for a thermistor for Adafruit Learning System // https://learn.adafruit.com/thermistor/using-a-thermistor by Limor Fried, Adafruit Industries // MIT License - please keep attribution and consider buying parts from Adafruit // the value of the 'other' resistor #include // *** // *** Define the RX and TX pins. Choose any two // *** pins that are unused. Try to avoid D0 (pin 5) // *** and D2 (pin 7) if you plan to use I2C. // *** #define RX 2 // *** D3, Pin 2 #define TX 1 // *** D4, Pin 3 // *** // *** Define the software based serial port. Using the // *** name Serial so that code can be used on other // *** platforms that support hardware based serial. On // *** chips that support the hardware serial, just // *** comment this line. // *** SoftwareSerial Serial(RX,TX); // What pin to connect the sensor to #define SENSORPIN 3 void setup(void) { Serial.begin(9600); } void loop(void) { int reading; reading = analogRead(SENSORPIN); //Serial.print("Analog reading "); //Serial.println(reading); // convert the value to resistance //reading = (1023 / reading) - 1; // (1023/ADC - 1) //reading = SERIESRESISTOR / reading; // 10K / (1023/ADC - 1) //reading = reading - reading2; //Serial.print("Thermistor resistance "); Serial.println(reading); delay(50); }